<!Doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=375, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="keywords" content="" />
    <meta id="m1" itemprop="name" content=""/>
    <meta id="m2"  itemprop="image" content="" />
    <meta id="m3"  name="description" itemprop="description" content="" />
    <link rel="icon" href="../img/da.ico">
    <title>文章</title>
    <script src="js/ueditor.parse.js" ></script>
    <link href="css/article.css" rel="stylesheet" type="text/css" />
    <!--<style>-->
        <!--.share{-->
            <!--width: 100%;-->
            <!--height:100%;-->
            <!--position: fixed;-->
            <!--background-color: #000;-->
            <!--/*opacity: .6;*/-->
            <!--top:0;-->
            <!--z-index: 100000;-->
        <!--}-->
        <!--.share>img{-->
            <!--width:100%;-->
            <!--position: relative;-->
            <!--top:50%;-->
        <!--}-->
    <!--</style>-->
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js"></script>
    <script src="js/jquery-1.12.2.min.js"></script>
    <script type="text/javascript" src="../js/session.js"></script>
</head>
<body>
<div class="downloadApp">
</div>
<div class="articleH5">
    <div class="title"></div>
    <div class="articleRealm"></div>
    <div class="nameTime clear">
        <!--<span>陈奕迅</span>-->
        <!--<span>2015.10.14 10:00</span>-->
        <!--<span>20000 阅读</span>-->
    </div>
    <div class="abstracts"></div>
    <div class="content"></div>
    <div class="fromSource clear"></div>
    <div class="articleEvaluate"><span></span></div>
    <ul class="evaluate">
        <!--<li>-->
        <!--<div>-->
        <!--<img src="img/Icon-60@3x.png" alt=""/>-->
        <!--<span>罗文杲</span>-->
        <!--<span> 5 &nbsp;<img src="img/like.png" alt=""/></span>-->
        <!--</div>-->
        <!--<p  class="clear">-->
        <!--杂志是国内外公开发行的国家级专业性综合学术期刊，创刊于1993年，卫生部原部长陈敏章、副部长顾英奇为创刊题词，在有关领导、各位编委、专家、作者、读者及广大医务工作者大力支持和帮助下，刊物质量不断提高，国内外影响逐步扩大。现已被《中国知网》、《中国万方数据》、《中国学术期刊综合评价数据库》、《中国期刊全文数据库》、《中国核心期刊（遴选）数据库》等多家数据库收录。本刊由中华人民共和国卫生部主管，由中国康复医学会和黑龙江省截瘫研究所主办，为医务人员评职、考核、晋级提供重要依据。-->
        <!--</p>-->
        <!--<p>3分钟前</p>-->
        <!--</li>-->
    </ul>
</div>
<script src="js/articleH5.js"></script>
<script>


    function getArticle(prams,callBack){
        $.ajax({
            async: true,
            type: "get",
            data: prams,
            cache: false,
            url: endpoint + "getArticle" + jsonpoint,
            success:function(data){
                //微信二次分享
                //var shareId = $.session.get('shareId');

                var weixin='';
                var shareArticle=data;
                console.log(shareArticle)
                function getWeixin(prams,callBack){
                    $.ajax({
                        async: true,
                        type: "get",
                        data: prams,
                        cache: false,
                        url: endpoint + "getSignature" + jsonpoint,
                        success:function(data){
                            //console.log(data)
                            return callBack(data);
                        }
                    })
                }
//获取产品
                $(function(){
                    addData();
                    function addData(){
                        var lineLink =window.location.href;
                        var shareTitle = shareArticle.article.title;
                        var descContent =shareArticle.article.abstracts;
                        //imgUrl图片
                        var imgUrl=shareArticle.article.coverImage;
//                        var imgUrl= 'http://api.ixinghui.com:81/ixinghui-share/img/sher.png';
                        //qq
                        setShareInfo({
                            title: shareTitle,
                            summary:descContent,
                            pic:  imgUrl,
                            url:window.location.href
                        });
                        $('#m1').attr('content',shareTitle);//标题
                        $('#m3').attr('content',descContent);//摘要
                        $('#m2').attr('content',imgUrl);//图片
                        getWeixin(
                                {'url':url},
                                function(data){
                                    weixin=data;
                                    wx.config({
                                        debug:false,// 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印
                                        appId:weixin.appId,// 必填，公众号的唯一标识
                                        timestamp:weixin.timestamp,// 必填，生成签名的时间戳
                                        nonceStr:weixin.nonceStr,// 必填，生成签名的随机串
                                        signature:weixin.signature,// 必填，签名，见附录1
                                        jsApiList:['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareQZone']//必填，需要使用的JS接口列表
                                    });
                                    wx.ready(function () {
                                        wx.onMenuShareTimeline({
                                            title: shareTitle, // 分享标题
                                            desc: descContent, // 分享说明
                                            link: lineLink, // 分享链接
                                            imgUrl:imgUrl // 分享图标
                                        });
                                        wx.onMenuShareAppMessage({
                                            title: shareTitle, // 分享标题
                                            desc: descContent, // 分享说明
                                            link: lineLink, // 分享链接
                                            imgUrl:imgUrl, // 分享图标
                                            type: 'link', // 分享类型,music、video或link，不填默认为link
                                            dataUrl:imgUrl, // 如果type是music或video，则要提供数据链接，默认为空
                                            success: function (msg) {

                                            }
                                        });
                                        //qq好友
                                        wx.onMenuShareQQ({
                                            title: shareTitle, // 分享标题
                                            desc: descContent, // 分享说明
                                            link: lineLink, // 分享链接
                                            imgUrl:imgUrl // 分享图标
                                        });
                                        //qq空间
                                        wx.onMenuShareQZone({
                                            title: shareTitle, // 分享标题
                                            desc: descContent, // 分享说明
                                            link: lineLink, // 分享链接
                                            imgUrl:imgUrl // 分享图标
                                        });
                                    });
                                })
                    }
                })
                return callBack(data);
            }
        })
    }
    getArticle(
            {
                articleId:articleId,
                isH5:1,
                userId:userId
            },
            function(data){
                console.log(data);
                var articleEvaluates=data.articleEvaluate;
                var articleRealms=data.article.articleRealm;
                //                领域
                for(var i=0,articleRealm="",n=articleRealms.length;i<n;i++){
                    articleRealm+=`
                        <div>`;
                    if(articleRealms[i].realmId==29){
                        articleRealm+= `<img src="img/29.png" alt="">`;
                    }else if(articleRealms[i].realmId==30){
                        articleRealm+= `<img src="img/30.png" alt="">`;
                    }else if(articleRealms[i].realmId==31){
                        articleRealm+= `<img src="img/31.png" alt="">`;
                    }else if(articleRealms[i].realmId==32){
                        articleRealm+= `<img src="img/32.png" alt="">`;
                    }else if(articleRealms[i].realmId==33){
                        articleRealm+= `<img src="img/33.png" alt="">`;
                    }else if(articleRealms[i].realmId==34){
                        articleRealm+= `<img src="img/34.png" alt="">`;
                    };
                    articleRealm+=`<span>${articleRealms[i].name}</span></div> `;
                }


//                时间
                var nameTimeHtml=`
                   <span>${data.article.authorName}</span>`;
                var time=data.article.postedTime.slice(0,data.article.postedTime.length-3);
                nameTimeHtml+=`
                   <span>${time}</span>
                    <span>${data.article.readNumber} 阅读</span>
                `;
                var nameTimeHtml1=`
                   <span>${data.article.authorName}</span>`;
                var time1=data.article.postedTime.slice(0,data.article.postedTime.length-3);
                nameTimeHtml1+=`
                   <span>${time1}</span>
                `;
                for(var i= 0,evaluateHtml='',time,count=articleEvaluates.length;i<count;i++){
                    evaluateHtml+=`<li>
                    <div>
                        <img src="${articleEvaluates[i].user.user.headURL}" alt=""/>
                        <span>${articleEvaluates[i].user.realName}</span><span> <img  src="img/like.png" alt=""/></span><span style="color:#0AC2C7">${articleEvaluates[i].articleThumbupNum}</span>
                        </div>
                    <p>
                        <span class="p1">${articleEvaluates[i].content}</span>
                        <span class="p2">${articleEvaluates[i].createTime}</span></p>
                </li>`;
                }

                if(GetQueryString('h5')==1){
                    console.log(2);
                    $('.articleH5').css({
                        "marginTop":0,
                        "paddingTop":0
                    });
                    $('.downloadApp').remove();
                    $('.articleRealm').remove();
                    $('.title').remove();
                    $('.nameTime').remove();
                    $('.abstracts').remove();
                    $('.content').html(data.article.content);

                }else if(GetQueryString('h5')==2){
                    console.log(3);
                }else if(GetQueryString('h5')==3){
                    console.log(4);
                    $('.articleH5').css({
                        "marginTop":0,
                        "paddingTop":0
                    });
//                    $('.downloadApp').html(`
//                        <img src="img/tubiao.png">
//                        <a>课程表</a>
//                        <i>打开App</i>
//                    `).css('borderBottom','1px solid #eee').show();
                    $('.abstracts').remove();
                    $('.content').html(data.article.content);
                    $('.title').html(data.article.title);
                    $('.articleRealm').html(articleRealm);
                    $('.nameTime').html(nameTimeHtml1);
                }else{
                    console.log(5);
                    $('.articleH5').css({
                        "marginTop":65,
                        "paddingTop":20
                    });
                    $('.downloadApp').html(`
                        <img src="img/tubiao.png">
                        <a>课程表</a>
                        <i>打开App</i>
                    `).css('borderB-bottom','1px solid #eee').show();
                    $('.content').html(data.article.content);
                    $('.title').html(data.article.title);
                    if(data.article.isShowAbstracts==1){
                        if(data.article.abstracts==''){
                            $('.abstracts').hide();
                        }else{
                            $('.abstracts').html(data.article.abstracts).css({  backgroundColor: '#F6F6F6'});
                        }
                    }else{
                        $('.abstracts').css('padding',0).hide();
                    }
                    if(data.article.fromSource==''||data.article.fromSource==undefined){
                        $('.fromSource').hide();
                    }else{
                        $('.fromSource').html('文章来源:'+data.article.fromSource);
                    }
                    $('.articleEvaluate>span').html('评论 ('+ data.articleEvaluate.length+')').css({borderLeft:'2px solid #000'});
                    $('.nameTime').html(nameTimeHtml);
                     $('.articleRealm').html(articleRealm);
                    if(articleEvaluates.length==0){
                        $('.evaluate').html(`<li><img style="margin-left: 36.8%;width:26.4%;" src="img/sofa.png" alt=""/></li>`);
                    }else{
                        $('.evaluate').html(evaluateHtml);
                    }
                }
//                $('img').click(function(){
//                    var imgHeight=parseInt($(this).css('height'));
//                    var share=`
//                            <div class="share">
//                                <img src="${$(this).attr('src')}" alt=""/>
//                            </div>
//                        `
//                    $("body").prepend(share);
//                    $(" .share>img").css({'marginTop':-imgHeight/2});
//                    $('.share').click(function(){
//                        $('.share').hide();
//                    });
//
//                })
                //点击打开课程表
                $(".downloadApp>a").on("click", function () {
                    window.location.href="../member/timetable.html#userId="+userId;
                })

                //点击打开app
                $(".downloadApp>i").on("click", function () {
                    if (browser.versions.mobile) {//判断是否是移动设备打开。browser代码在下面
                        var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
                        var localUrl="";
                        if (browser.versions.ios) {
                            //打开中间页
                            window.location.href="../static.html?jumpType=9&articleId="+articleId;
                        }
                        if(browser.versions.android){
                            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                //在微信中打开
                                //打开中间页
                                window.location.href="../static.html?jumpType=9&articleId="+articleId;
                                window.open("../static.html?jumpType=9&articleId="+articleId);
                            }
                            if (ua.match(/WeiBo/i) == "weibo") {
                                localUrl="ixinghui://ixinghui.share.com?jumpType=9&articleId="+articleId;
                                window.location.href = localUrl;
                            }
                            if (browser.versions.MQQBrowser) {
                                //在QQ打开
                                localUrl="ixinghui://ixinghui.share.com?jumpType=9&articleId="+articleId;
                                window.location.href = localUrl;
                            }
                        }
                    }else {
                        //否则就是PC浏览器打开
                        window.open("http://android.myapp.com/myapp/detail.htm?apkName=com.yunxuan.ixinghui")
                    }
                })
				uParseT('.content',{
                    rootPath: 'js/'
                })
            }
    )


</script>

</body>